﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Client;

namespace ClientUnitTest
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void CreateUserTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.CreateUser, "angelosenna" + "," + "password" + "," + "Angelo" + "," + "Senna" + "," + "angelo@ccc" + "," + "40123456"), "$SAU,CU,angelosenna,password,Angelo,Senna,angelo@ccc,40123456");
        }
        
        [TestMethod]
        public void LoginTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.Login, "test" + "," + "test"), "$SAU,LI,test,test");
        }

        [TestMethod]
        public void GetProfileTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.GetProfile, "test"), "$SAU,GP,test");
        }

        [TestMethod]
        public void GetUserTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.GetUser, "test"), "$SAU,GU,test");
        }

        [TestMethod]
        public void UpdateProfileTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.UpdateProfile, "angelosenna" + "," + "password" + "," + "Angelo" + "," + "Senna" + "," + "angelo@ccc" + "," + "40123456"), "$SAU,UP,angelosenna,password,Angelo,Senna,angelo@ccc,40123456");
        }

        [TestMethod]
        public void DeleteUserTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.DeleteUser, "test"), "$SAU,DU,test");
        }

        [TestMethod]
        public void GetUserListTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.GetUserList, "test"), "$SAU,GUL,test");
        }

        [TestMethod]
        public void AddFileTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.AddFile, "xDoc"), "$SAU,AF,xDoc");
        }

        [TestMethod]
        public void NameFileTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.NameFile, "xDoc"), "$SAU,NF,xDoc");
        }

        [TestMethod]
        public void FileExistsTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.FileExists, "xDoc"), "$SAU,FE,xDoc");
        }

        [TestMethod]
        public void DeleteFileTest()
        {
            Protocol protocol = new Protocol();
            Assert.AreEqual(Protocol.Command(SaunaProtocol.DeleteFile, "xDoc"), "$SAU,DF,xDoc");
        }
    }
}
